package cn.iocoder.yudao.module.pypm.dal.mysql.project;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.pypm.dal.dataobject.project.ProjectDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.pypm.controller.admin.project.vo.*;

/**
 * 项目信息 Mapper
 *
 * @author 钦州码头
 */
@Mapper
public interface ProjectMapper extends BaseMapperX<ProjectDO> {

    default PageResult<ProjectDO> selectPage(ProjectPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProjectDO>()
                .likeIfPresent(ProjectDO::getName, reqVO.getName())
                .betweenIfPresent(ProjectDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ProjectDO::getDescription, reqVO.getDescription())
                .betweenIfPresent(ProjectDO::getStartDate, reqVO.getStartDate())
                .betweenIfPresent(ProjectDO::getEndDate, reqVO.getEndDate())
                .eqIfPresent(ProjectDO::getState, reqVO.getState())
                .eqIfPresent(ProjectDO::getAvailable, reqVO.getAvailable())
                .orderByDesc(ProjectDO::getId));
    }

}